
<!doctype html>
<html>

<head>
    <meta charset="UTF-8">
    <title>发来看看咯123</title>
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <link href="http://hc.588net.com/public/static/libs/weui/mui.min.css" rel="stylesheet" />
    <link href="http://hc.588net.com/public/static/topic/css/common.css" type="text/css" rel="stylesheet" />
    <link href="http://hc.588net.com/public/static/topic/css/index.css" type="text/css" rel="stylesheet" />
</head>
<style>
    html {
        font-size: 20px;
    }

    #edit {
        padding: .5rem;
    }
    .title{color:#5A5A5A;}
    textarea {
        min-height: 6rem;
        width: 100%;
        height: 100%;
        overflow-y: visible
    }

    .uoload_img {
        overflow: hidden;
    }

    .uoload_img span {
        float: right;
    }

    .txtarea {
        border: 1px solid rgba(0, 0, 0, .2);
        padding: 10px 15px;
        border-radius: 3px;
        outline: 0;
        background-color: #fff;
        outline: none;
        min-height: 200px;
        -webkit-appearance: none;
        margin-bottom: 1rem;
        font-size: 16px;
        color: #5A5A5A;
    }
    .mui-col-sm-4 {
        padding-left: .5rem;
        margin-bottom: .5rem;
        width: 33.2%!important
    }
    .mui-col-sm-4:nth-last-of-type(3){
        margin-right: 0;
    }
.load{transition: -webkit-transform 0.3s ease-in; transform: rotate(180deg); animation: spinner-spin 1s step-end infinite;}

.loading{
    /*border: 1px solid #D1D1D1;*/
	background:url(img/loading.gif) no-repeat center;
}
</style>

<body>
<section id="edit">
    <form onsubmit="return false;">
        <div class="title">
            <textarea name="subject" class="txtarea" style="height: auto;min-height: 60px" type="text"   >发来看看咯123</textarea></textarea>
        </div>
        <div class="content">
            <textarea class="txtarea" name="message" style="-webkit-user-select:text">急用吗</textarea>
        </div>

        <div class="photo">
            <div class="img-box full">
                <section class=" img-section">
                    <p class="up-p">上传图片：<span class="up-span">最多可以上传9张图片，马上上传</span></p>
                    <div class="mui-content">
                        <div class="mui-row z_photo upimg-div clear">
                            <section class="mui-col-sm-4 z_file fl" id="upload">
                                <img src="/public/static/topic/img/a11-larger.png" class="add-img">
                                <input type="file" name="file" id="file" class="file" value="" accept="image/jpg,image/jpeg,image/png,image/bmp" multiple onchange="ajaxFileUpload()" />
                            </section>
                        </div>
                    </div>
                </section>
            </div>
            <aside class="mask works-mask">
                <div class="mask-content">
                    <p class="del-p">您确定要删除作品图片吗？</p>
                    <p class="check-p"><span class="del-com wsdel-ok">确定</span><span class="wsdel-no">取消</span></p>
                </div>
            </aside>
        </div>
        <div class="mui-card-footer">
            <input name="uid" type="hidden" value="3717435">
            <input name="accessToken" type="hidden" value="335a25d7083691f0c5c0d52fc32c2">
            <input name="accessSecret" type="hidden" value="77dc053dd95eb6f24cb82637cb695">
            <input name="tid" type="hidden" value="1802367">
            <input name="pid" type="hidden" value="18551817">
            <input name="fid" type="hidden" value="710">
            <button class="mui-btn-block ajax-post" style="background-color:#407fad;color: white">提交</button>
        </div>
    </form>
</section>
<div id="sheet1" class="mui-popover mui-popover-bottom mui-popover-action ">
    <!-- 可选择菜单 -->
    <ul class="mui-table-view">
        <li class="mui-table-view-cell">
            <a href="#">拍照</a>
        </li>
        <li id="photo" class="mui-table-view-cell">
            <a href="#">相册</a>
        </li>
    </ul>
    <!-- 取消菜单 -->
    <ul class="mui-table-view">
        <li class="mui-table-view-cell">
            <a href="#sheet1"><b>取消</b></a>
        </li>
    </ul>
</div>
<div class="mui-pull-loading mui-icon mui-spinner load"></div>

<script src="http://hc.588net.com/public/static/libs/weui/mui.min.js"></script>
<script src="http://hc.588net.com/public/static/libs/weui/jquery-2.1.4.js"></script>
<script type="text/javascript" src="http://hc.588net.com/public/static/libs/jquery-ajaxfileupload/ajaxfileupload.js"></script>
<script type="text/javascript">
    mui.init();
    function back() {
        var ua = navigator.userAgent.toLowerCase();
        if (/iphone|ipad|ipod/.test(ua)) {
            back_page();
        }else{
            viewPage.back_page();
        }
    }
    $(function () {
        var has_power=1;
        if(has_power==0){
            mui.alert("非版主不得编辑此贴",function () {
               back();
            });
        }
    })
    function ajaxFileUpload() {
    	var ht='';
    	ht+='<section class="mui-col-sm-4 up-section fl loading"></section>'
    	
    	 $('#upload').before(ht);
        $.ajaxFileUpload
        (
                {
                    url: 'http://hc.588net.com/index.php/company/upload/upload', //用于文件上传的服务器端请求地址
                    type: 'post',
                    data: {},
                    secureuri: false, //是否需要安全协议，一般设置为false
                    fileElementId: 'file', //文件上传域的ID
                    dataType: 'json', //返回值类型 一般设置为json
                    success: function (data, status)  //服务器成功响应处理函数
                    {
                        var html='';
                        //var ht='';
                       // ht+='<div class="mui-pull-loading mui-icon mui-spinner load"></div>';
                        // $('#upload').before(ht);
                        if(data.code==200){
                        	$(".mui-col-sm-4").removeClass("loading");
                            html+='<section class="mui-col-sm-4 up-section fl loading"><span class="up-span"></span>';
                            html+='<img class="close-upimg" src="/public/static/topic/img/a7.png">';
                            html+=' <img class="up-img" src="'+data.data.path+'">';
                            html+='<input value="'+data.data.id+'" name="pics[]"  type="hidden">';
                            html+='</section>';
                            //$('.load').hide();
                        }else{
                        	
                            mui.alert(data.msg,function(){
                                return false;
                            })
                        }
                        $('#upload').before(html);
                    },
                    error: function (data, status, e)//服务器响应失败处理函数
                    {
                        alert(e);
                    }
                }
        )
        return false;
    }
    $('body').on("click",'.up-section',function () {
        var that=$(this);
        mui.confirm('是否删除？','提示',["取消","确认"],function (e) {
            console.log(e);
                if(e.index){
                    that.remove();
                }
        })
    });
    $('body').on('tap','.ajax-post',function () {
        $.post('http://hc.588net.com/index.php/topic/topic_post/ajax_post.html',$('form').serialize(),function(e){
            if(e.code==200){
                mui.alert(e.msg,function () {
                    back();
                })
            }else{
                mui.alert(e.msg);
            }
        },'json');
    })
</script>
<script>

</script>
</body>

</html>